import request from '@/utils/request'

// 查询轮播列表
export function listImages(query) {
	return request({
		url: '/course/images/list',
		method: 'get',
		params: query
	})
}

// 查询课程列表
export function listCourse(query) {
	return request({
		url: '/course/info/list',
		method: 'get',
		params: query
	})
}

// 查询课程详细
export function getCourse(id) {
	return request({
		url: '/course/info/' + id,
		method: 'get'
	})
}

// 查询课程列表(已购买)
export function listCoursePay(query) {
	return request({
		url: '/course/purchased/list',
		method: 'get',
		params: query
	})
}

// 加入购买课程
export function addCourseBuy(data) {
	return request({
		url: '/course/purchased',
		method: 'post',
		data: data
	})
}

// 查询课程详细(章节视频)
export function getChapterVideos(id) {
	return request({
		url: '/course/info/ByCourseId/' + id,
		method: 'get'
	})
}

// 查询课程订单
export function listOrder(query) {
	return request({
		url: '/course/orders/list',
		method: 'get',
		params: query
	})
}

// 加入购物车
export function addCart(data) {
	return request({
		url: '/course/cart',
		method: 'post',
		data: data
	})
}

// 购物车列表查询
export function listCart(query) {
	return request({
		url: '/course/cart/list',
		method: 'get',
		params: query
	})
}

// 新增课程订单
export function addOrder(data) {
	return request({
		url: '/course/orders',
		method: 'post',
		data: data
	})
}

// 删除课程订单
export function delOrder(ids) {
	return request({
		url: '/course/orders/' + ids,
		method: 'delete'
	})
}

// 查询评价列表
export function listReviews(query) {
	return request({
		url: '/course/reviews/list',
		method: 'get',
		params: query
	})
}

// 新增评论
export function addComment(data) {
	return request({
		url: '/course/reviews',
		method: 'post',
		data: data
	})
}